'use strict';

var mongoose = require('mongoose'),
    Schema = mongoose.Schema,
    baseController = require('../../../Base/server/controllers/BaseDoc.js');

var workLocationModel = baseController.getBaseDocFields();
workLocationModel.Code = {
    type: String,
    default: '',
    trim: true
};
workLocationModel.Name = {
    type: String,
    default:'',
    trim: true
};
workLocationModel.Department = {
    type: Schema.ObjectId,
    ref: 'Department'
};
//楼层
workLocationModel.Floor = {
    type: String
};
//区域
workLocationModel.Area = {
    type: String
};
workLocationModel.Remark = {
    type: String
};
workLocationModel.IsEffective = {
    type: Boolean
};

var workLocationSchema = new Schema(workLocationModel);
workLocationSchema.index({Name: 1});
workLocationSchema.index({Code: 1}, {"unique": true});

mongoose.model('WorkLocation', workLocationSchema, 'WorkLocation');
